
TOOL.Category = 'Carbon Systems'
TOOL.Name = 'Storage Devices'
TOOL.Command = nil
TOOL.ConfigName = ''
if (CLIENT and GetConVarNumber("RD_UseLSTab") == 1) then TOOL.Tab = "ESN Customs" end

TOOL.ClientConVar['type'] = 'carbon_storage'
TOOL.ClientConVar['model'] = 'models/props_c17/canister01a.mdl'

cleanup.Register('storagedevice')

if ( CLIENT ) then
	language.Add( 'Tool_carbonstor_name', 'Carbon Storage Devices' )
	language.Add( 'Tool_carbonstor_desc', 'Create Storage Devices attached to any surface.' )
	language.Add( 'Tool_carbonstor_0', 'Left-Click: Spawn a Device.  Right-Click: RepOxygen Device.' )

	language.Add( 'Undone_carbonstor', 'Storage Device Undone' )
	language.Add( 'Cleanup_carbonstor', 'LS: Storage Device' )
	language.Add( 'Cleaned_carbonstor', 'Cleaned up all Storage Devices' )
	language.Add( 'SBoxLimit_carbonstor', 'Maximum Storage Devices Reached' )
end

if not ( RES_DISTRIB == 2 ) then Error("Please Install Resource Distribution 2 Addon.'" ) return end

local carbonstor = {}
if (SERVER) then
	carbonstor.oxygen_tank = function( ply, ent, system_type, system_class, model )
		local rtable, maxhealth, mass = {}, 0, 0
		if ( model == "models/chipstiks_ls3_models/SmallOxygenTank/smalloxygentank.mdl" ) then
			maxhealth = 600
			mass = 20
			RD_AddResource(ent, "Oxygen", 6000)
		elseif ( model == "models/chipstiks_ls3_models/MediumOxygenTank/mediumoxygentank.mdl" ) then
			maxhealth = 1200
			mass = 200
			RD_AddResource(ent, "Oxygen", 12000)
		elseif ( model == "models/chipstiks_ls3_models/LargeOxygenTank/largeoxygentank.mdl" ) then
			maxhealth = 3000
			mass = 500
			RD_AddResource(ent, "Oxygen", 30000)
		end
		LS_RegisterEnt(ent, "Storage")
		return rtable, maxhealth, mass
	end

	carbonstor.co2_tank = function( ply, ent, system_type, system_class, model )
		local rtable, maxhealth, mass = {}, 0, 0
		if (model == "models/chipstiks_ls3_models/SmallCO2Tank/smallco2tank.mdl") then
			maxhealth = 300
			mass = 20
			RD_AddResource(ent, "CO2", 4000)
		elseif (model == "models/chipstiks_ls3_models/MediumCO2Tank/mediumco2tank.mdl") then
			maxhealth = 600
			mass = 200
			RD_AddResource(ent, "CO2", 12000)
		elseif (model == "models/chipstiks_ls3_models/LargeCO2Tank/largeco2tank.mdl") then
			maxhealth = 1000
			mass = 1000
			RD_AddResource(ent, "CO2", 30000)
		end
		LS_RegisterEnt(ent, "Storage")
		return rtable, maxhealth, mass
	end

	carbonstor.carbon_storage = function( ply, ent, system_type, system_class, model )
		local rtable, maxhealth, mass = {}, 0, 0
		if (model == "models/props_phx/life_support/tank_small.mdl") then
			maxhealth = 100
			mass = 20
			RD_AddResource(ent, "Carbon", 4000)
		elseif (model == "models/props_phx/life_support/tank_medium.mdl") then
			maxhealth = 4000
			mass = 1000
			RD_AddResource(ent, "Carbon", 50000)
		elseif (model == "models/props_phx/life_support/tank_large.mdl") then
			maxhealth = 9000
			mass = 4000
			RD_AddResource(ent, "Carbon", 100000)
		end
		LS_RegisterEnt(ent, "Storage")
		return rtable, maxhealth, mass
	end



	

end

local receptacle_models = {

	{ 'Small Oxygen Tank', 'models/chipstiks_ls3_models/SmallOxygenTank/smalloxygentank.mdl', 'oxygen_tank' },
	{ 'Medium Oxygen Tank', 'models/chipstiks_ls3_models/MediumOxygenTank/mediumoxygentank.mdl', 'oxygen_tank' },
	{ 'Large Oxygen Tank', 'models/chipstiks_ls3_models/LargeOxygenTank/largeoxygentank.mdl', 'oxygen_tank' },


	{ 'Small CO2 Tank', 'models/chipstiks_ls3_models/SmallCO2Tank/smallco2tank.mdl', 'co2_tank' },
	{ 'Medium CO2 Tank', 'models/chipstiks_ls3_models/MediumCO2Tank/mediumco2tank.mdl', 'co2_tank' },
	{ 'large CO2 Tank', 'models/chipstiks_ls3_models/LargeCO2Tank/largeco2tank.mdl', 'co2_tank' },


	{ 'Small Carbon Storage', 'models/props_phx/life_support/tank_small.mdl', 'carbon_storage' },
	{ 'Medium Carbon Storage', 'models/props_phx/life_support/tank_medium.mdl', 'carbon_storage' },
	{ 'Large Carbon Storage', 'models/props_phx/life_support/tank_large.mdl', 'carbon_storage' },

	
	
}

RD2_ToolRegister( TOOL, receptacle_models, nil, "carbonstor", 30, carbonstor )
